


//创建进度条部件
lv_obj_t* bar = lv_bar_create(lv_scr_act());
    //设定大小
    lv_obj_set_size(bar, 400, 20);
    //动画设置必须放在当前值设置之前
    //500为加载时间参数
    lv_obj_set_style_anim_time( bar, 500, LV_STATE_DEFAULT);
    //加载到50
    lv_bar_set_value(bar, 50, LV_ANIM_ON);
    //进度条范围-100~100
    lv_bar_set_range(bar, -100, 100);


    //实例

    //定义标签
static void lv_label(void)
{
    label = lv_label_create(lv_scr_act());
    lv_label_set_text(label, "0 \%");
    lv_obj_set_style_text_font(label, &amp;lv_font_montserrat_20, LV_PART_MAIN);
    lv_obj_align(label, LV_ALIGN_CENTER,0,100);
}
int val = 0;
static void timer_cb(lv_timer_t* timer)
{
    if(val < 100)
    {
        val++;
        lv_bar_set_value(bar, val, LV_ANIM_ON);
        lv_label_set_text_fmt(label, "%d %%",lv_bar_get_value(bar));
    }
    else
         lv_label_set_text(label, "finished!");
}
//定义进度条
static void lv_bar()
{
    bar = lv_bar_create(lv_scr_act());
    lv_obj_set_size(bar, 400, 20);
    lv_obj_set_align(bar,LV_ALIGN_CENTER);
    //定时器，每隔50ms进入一次timer_cb
    lv_timer_create(timer_cb, 50, NULL);
}
//主程序
void my_gui(void)
{
    lv_label();
    lv_bar();
}
